package com.summer.data.jql.with;

import com.summer.data.Jql;
import com.summer.data.jql.behavior.TableAble;

/**
 * @author 345480567@qq.com
 */

public class With9<T1 extends TableAble, T2 extends TableAble, T3 extends TableAble, T4 extends TableAble, T5 extends TableAble, T6 extends TableAble, T7 extends TableAble, T8 extends TableAble, T9 extends TableAble> {

    private T1 t1;
    private T2 t2;
    private T3 t3;
    private T4 t4;
    private T5 t5;
    private T6 t6;
    private T7 t7;
    private T8 t8;
    private T9 t9;

    public With9(Class<T1> clazz1, Class<T2> clazz2, Class<T3> clazz3, Class<T4> clazz4, Class<T5> clazz5,
            Class<T6> clazz6, Class<T7> clazz7, Class<T8> clazz8, Class<T9> clazz9) {
        try {
            t1 = clazz1.newInstance();
            t2 = clazz2.newInstance();
            t3 = clazz3.newInstance();
            t4 = clazz4.newInstance();
            t5 = clazz5.newInstance();
            t6 = clazz6.newInstance();
            t7 = clazz7.newInstance();
            t8 = clazz8.newInstance();
            t9 = clazz9.newInstance();
        } catch (InstantiationException e) {
            throw new RuntimeException(e);
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
        }
    }

    public With9<T1, T2, T3, T4, T5, T6, T7, T8, T9> autoAlias() {
//        t1.alias("t1");
//        t2.alias("t2");
//        t3.alias("t3");
//        t4.alias("t4");
//        t5.alias("t5");
//        t6.alias("t6");
//        t7.alias("t7");
//        t8.alias("t8");
//        t9.alias("t9");
        return this;
    }

    public Jql then(With9Fun<T1, T2, T3, T4, T5, T6, T7, T8, T9> fun) {
        return fun.returnJql(t1, t2, t3, t4, t5, t6, t7, t8, t9);
    }
}
